document.addEventListener('DOMContentLoaded', function() {
    // 轮播图功能
    const slides = document.querySelectorAll('.slide');
    let currentSlide = 0;
    
    function showSlide(n) {
        slides.forEach(slide => slide.classList.remove('active'));
        currentSlide = (n + slides.length) % slides.length;
        slides[currentSlide].classList.add('active');
    }
    
    // 自动轮播
    setInterval(() => {
        showSlide(currentSlide + 1);
    }, 5000);

    // 响应式调整
    function handleResize() {
        if (window.innerWidth < 768) {
            document.querySelector('.banner').style.height = '300px';
        } else {
            document.querySelector('.banner').style.height = '500px';
        }
    }

    window.addEventListener('resize', handleResize);
    handleResize();
});